<?php
$string = new String();
$other = new other();

class String {
	function Between($text,$left,$right)/* 取文本中间 */
	{
		$str = $text;
		$leftlen = strlen($left);
		$startpos = strpos($str,$left)+$leftlen;
		if ($startpos ==false)
		{
			return;
		}
		if ($startpos > strlen($str))
		{
			return;
		}
		$endpos = strpos($str,$right,$startpos);
		$result = substr($str,$startpos,$endpos-$startpos);
		return $result;
	}
	function randomkeys($length)
	{
		$pattern='1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLOMNOPQRSTUVWXYZ';
		for($i=0;$i<$length;$i++)
		{
		$key .= $pattern{mt_rand(0,35)};    //生成php随机数
		}
		return $key;
	}
	function left($str,$mark){
		$pos = strpos($str,$mark);
		$result= substr($str,$pos);
		return $result;
	}
	function right($str,$mark){
		$pos = strpos($str,$mark);
		$pos =$pos +strlen($mark);
		$result= substr($str,$pos,strlen($str)-$pos);
		return $result;
	}
}
class other {
	
	function save($name,$str)
	{
		$name=$name.".txt";
		if (!file_exists($name))
		{
			$fp=fopen($name,'a');
			fclose($fp);
		}
			$fp=fopen($name,'a');
			fwrite($fp,$str."\r\n");
			fclose($fp);
		
	}
}

?>